import { createRouter, createWebHashHistory } from "vue-router";

const routes = [
  {
    path: '/',
    redirect: '/home',
  },
  {
    path: '/home',
    name: 'App',
    component: () => import('../App')
  },
  {
    path: '/home2',
    name: 'App2',
    component: () => import('../App')
  },
  {
    path: '/demo-page',
    name: 'Demo',
    component: () => import('../views/demo-page')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes: routes,
})

router.beforeEach((to, from) => {
  // 返回 false 则取消导航
  console.log('to:', to)
  console.log('from:', from)
  return true
})

export default router
